def quik(L):
    temp_index = 0
    end_index = len(L)
    temp = L[0]
    left_tag = 0
    right_tag = 0
    for i in range(0,end_index):        
        if L[i] < temp:
            arryLi = L            
            L = mv(temp_index, i, arryLi)
            temp_index = temp_index + 1
            left_tag = left_tag + 1
        elif L[i] > temp:
            arryLi = L
            L = mv(temp_index+1, i, arryLi)
            right_tag = right_tag + 1
        else:
            right_tag = right_tag + 1
    if left_tag > 1:
        array_digui_left = L[temp_index-left_tag:temp_index]
        L[temp_index-left_tag:temp_index] = quik(array_digui_left)
    if right_tag > 1:
        array_digui_right = L[temp_index+1:temp_index+1+right_tag]
        L[temp_index+1:temp_index+1+right_tag] = quik(array_digui_right)
    return L

def mv(star_targ,end_targ,Li):
    z = Li[end_targ]
    for i in range(star_targ, end_targ):
        Li[end_targ] = Li[end_targ-1]
        end_targ = end_targ -1
    Li[star_targ] = z
    return Li

def mv2(star_targ,end_targ,Li):
    z = Li[star_targ]
    for i in range(star_targ, end_targ):
        Li[star_targ] = Li[star_targ+1]
    Li[end_targ] = z
    return Li

print quik([9,9,32,5,1,8,23,0,3,2,9,7,7,10,45])